import 'package:flutter_app/app/models/category.dart';
import 'package:flutter_app/app/models/subcategory.dart';
import 'package:flutter_app/app/networking/category_api_service.dart';
import 'package:flutter_app/app/networking/subcategory_api_service.dart';

import '/app/controllers/controller.dart';
import 'package:flutter/widgets.dart';

class DashboardController extends Controller {
  CategoryApiService _categoryApiService = CategoryApiService();

  SubcategoryApiService _subcategoryApiService = SubcategoryApiService();

  @override
  construct(BuildContext context) {
    super.construct(context);
  }

  // 获取一级分类（电影&电视剧）
  Future<Category> getCategories(String type) async {
    return await _categoryApiService.fetchData(type);
  }

  // 获取二级分类
  Future<Subcategory> getSubCategories(
      String type, String tag, int page) async {
    return await _subcategoryApiService.fetchData(type, tag, page);
  }
}
